
<?php	
	
	class productimage extends database
	{
		var $connection = '';	

		function productimage()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from vnf_product_image";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();			
            $sql = "Select * from vnf_product_image";				
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
        
        function AddProductImage($ProductNo	, $ProductImage)
		{
            $DateSubmit=date('Y-m-d H:i:s', time());
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Insert into vnf_product_image(`ProductNo`, `ProductImage`) 
            values('".$ProductNo."', '".$ProductImage."')";
            //echo $sql;
			$this->setQuery($sql);
			$this->query();
		}
		
		function UpdateProductImage($ProductNo	, $ProductImage, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_product_image set `ProductNo` =  '".$ProductNo."', 
            `ProductImage` = '".$ProductImage."'";
			$sql .= " where ProductimageID=".$id;	
            //echo $sql;		
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOneProductImage($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_product_image where ProductimageID=".$id."";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteProductImage($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Delete from vnf_product_image ";
			$sql .= " where ProductimageID=".$id;			
			$this->setQuery($sql);
			$this->query();
		}
	
		
	}
?>